import request from '@/utils/request'

export function add(params) {
    return request({
        url: 'order/add',
        method: 'POST',
        data: params
    }).then(res => {
        return res
    })
}
export function getList(params = {}) {
    return request({
        url: 'order/list',
        method: 'POST',
        data: params
    }).then(({
        data
    }) => {
        return data
    })
}
export function delItem(params) {
    return request({
        url: 'order/delete',
        method: 'POST',
        data: params
    }).then(res => res)
}
export function getDetail(params) {
    return request({
        url: 'order/detail',
        method: 'POST',
        data: params
    }).then(({
        data
    }) => data)
}
export function update(params) {
    return request({
        url: 'order/edit',
        method: 'POST',
        data: params
    }).then(res => res)
}
export function getPayList(params) {
    return request({
            url: '/order/payList',
            method: 'POST',
            data: params
        })
        .then(({ data }) => data)
}
export function importData(params = {}) {
    const { file } = params
    let formData = new FormData();
    formData.append('file', file);
    return request({
        url: '/order/importExcel',
        method: 'POST',
        data: formData,
        timeout: 1000 * 60 * 3,
    }).then(res => {
        return res
    })
}